package com.audiocap;

public final class NativeSoundTouch {

	private static NativeSoundTouch instance = null;

	private long nativeSoundTouch;

//	public synchronized static NativeSoundTouch getSoundTouch() {
//		if (null == instance) {
//			instance = new NativeSoundTouch();
//		}
//
//		return instance;
//	}

	public NativeSoundTouch(int sampleRate, int channle, int bytesPerSample) {
		nativeSoundTouch = soundTouchCreate(sampleRate, channle, bytesPerSample);
	}

	public native long soundTouchCreate(int sampleRate, int channle, int bytesPerSample);

	public native void soundTouchDestory();

	public native String soundTouchgethVersion();
	
	public native void setPitchSemiTones(float pitch);
	
	public native void setTempoChange(float newTempo);
	
	public native void shiftingPitch(byte[] pcmData, int offset, int length);
	
	public native int receiveSamples(byte[] pitchData, int bufferLenght);
//	public native byte[] receiveSamples(int bufferLenght);

	public native void soundTouchFlushLastSamples();

	@Override
	protected void finalize() throws Throwable {

		soundTouchDestory();

		super.finalize();
	}
}
